//
//  XML_Bloomberg_Intraday.m
//  MacStockApp
//
//  Created by 英傑 翁 on 12/2/27.
//  Copyright (c) 2012年 翁英傑. All rights reserved.
//

#import "XML_Bloomberg_Intraday.h"

@implementation XML_Bloomberg_Intraday
- (id)init_identify:(NSString *)ident {
	
    if(self=[super init])
	{
        
        identify=ident;
        
        
    }
	
	return self;
}

-(void)dealloc{
    
    
    [super dealloc];
}



-(NSDictionary *)quote_data:(NSString *)symbol country:(NSString *)country  {
    
    //1.INTRADAY
    NSString *urls_bloomberg=@"http://m.bloomberg.com/iphone/apps/data.asp?pid=webpxta&Securities=AAPL%3AUS&Outfields=ITIME,PR005-I&bbipver=1.0.9,15a1f23dc13ef6aa9e3cfefe0e8112156e587453,iPad,iPhone%20OS,5.0.1,zh_TW,zh-Hant";    
    
    NSURL *  urla_bloomberg;
    urla_bloomberg = [NSURL URLWithString:urls_bloomberg];
    
    NSError * errorq_bloomberg = nil;
    NSString * download_string_bloomberg;
    
    //2.取出下載文字資料
    download_string_bloomberg=[NSString stringWithContentsOfURL:urla_bloomberg encoding: NSUTF8StringEncoding error:&errorq_bloomberg];    
    
    NSLog(@"bloomberg uel=%@",urls_bloomberg);
    NSLog(@"bloomberg=%@",download_string_bloomberg);
    //將資料分成列
    NSArray *csvLines ;	    
    csvLines = [download_string_bloomberg  componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
    for (int i=0;i<[csvLines count];i++) {
        NSString *lines=[csvLines objectAtIndex:i] ;       
        NSLog(@"%i %@",i,lines );
    }
    
    
    return nil;
    
}
@end
